package core.state;

import core.game.StateBasedGame;
import core.gui.GlassPane;

import core.input.Input;
import core.input.InputManager;
import core.input.InputReceiver;

import recorder.input.InputManagerRecorder;

import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;



public abstract class BasicState implements InputReceiver{
	
	protected StateBasedGame game;
	protected Input input;
	private int stateID;
	private InputManager inputManager;
	protected GlassPane glassPane;
	
	public BasicState(StateBasedGame game, int stateID){
		this.game = game;
		this.stateID = stateID;
		input = game.getInput();
		inputManager = new InputManagerRecorder();
		inputManager.addInputReceiver(this);
		//Initialize GlassPane
		glassPane = new GlassPane(input);
		inputManager.addInputReceiver(glassPane);
	}
	
	public GlassPane getGlassPane(){
		return glassPane;
	}
	
	public StateBasedGame getGame(){
		return game;
	}
	
	public Input getInput(){
		return input;
	}
	
	public int getID(){
		return stateID;
	}
	
	public InputManager getInputManager(){
		return inputManager;
	}
	
	public abstract void enter();
	
	public abstract void init();
	
	public abstract void render(Graphics2D g);
	
	public abstract void update(int deltaTime);
	
	public void keyPressed(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}

	public void keyReleased(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}

	public void keyTyped(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}

	public void mouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	public void mouseDragged(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	public void mouseMoved(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

}
